/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package actionForms;

import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

/**
 *
 * @author alocubiche
 */
public class ConnexionForm extends org.apache.struts.action.ActionForm{
    private String login;
    private String password;
    
        public String getLogin() {
        return login;
    }

    public void setLogin(String login) {
        this.login = login;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public ConnexionForm()
    {
        super();
    }
    
    @Override
    public ActionErrors validate(ActionMapping mapping, HttpServletRequest request){
        ActionErrors errors = new ActionErrors();
        if(getLogin() == null || getLogin().length() < 1)
        {
            errors.add("login", new ActionMessage("error.login.required"));
        }
        
        if(getPassword() == null || getPassword().length() < 1)
        {
            errors.add("password", new ActionMessage("error.password.required"));
        }
        
        return errors;       
        
    }
}
